<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>运营平台</title>
    
	<import type="css" basepath="__CSS__" file="bootstrap" />
	<import type="css" basepath="__CSS__" file="datetimepicker" />
	<import type="css" basepath="__CSS__" file="fontawesome" />
	<import type="css" basepath="__CSS__" file="fonts" />
	<import type="css" basepath="__CSS__" file="bootgrid" />
	<import type="css" basepath="__CSS__" file="style" />
	<import type="css" basepath="__CSS__" file="newStudentWeb" />
	
	
</head>

<body>
<div class="topNav">
    <span class="text"><i class="iconfont">&#xe607;</i><a href="{:U('Index/index')}" target="_top">首页</a>><span>惠通知管理</span></span>
</div>

<div class="contain">
    <div class="pageTitle">
        <h2 class="title">惠通知管理</h2>
    </div>
    <div class="tableBoxOne">
        <div class="scroll">
            <table id="grid" class="table table-bordered" data-selection="false" data-multi-select="false" data-row-select="false" data-keep-selection="false">
                <thead>
                <tr>
                    <th data-column-id="01" data-width="130">惠通知编号（ID）</th>
                    <th data-column-id="02" data-width="130" >商家名称</th>
                    <th data-column-id="03" data-width="130">标题</th>
                    <th data-column-id="04" data-width="100">发布时间</th>
                    <th data-column-id="05" data-width="280">有效期</th>
                    <th data-column-id="06" data-width="120">状态</th>
                    <th data-column-id="07" data-width="130"  data-formatter="newBenefitMangeDetails" data-sortable="true">操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="item" >
                <tr>
                    <td>{$item.id}</td>
                    <td>{$item.shop_name}</td>
                    <td>{$item.title}</td>
                    <td>{$item.add_time|date='Y-m-d',###}</td>
                    <td>{$item.start_time|date='Y-m-d',###}-{$item.end_time|date='Y-m-d',###}</td>
                    
                    <td class="zt">
					   <if condition="$item.check_status eq 1 ">
					          待审核
					   <elseif condition="$item.is_expired neq 100" />
						  已过期
					   <elseif condition="$item.is_open eq 1" />
						 <a href="{:U('Notice/opdown','id='.$item['id'].'&is_open='.$item['is_open'])}" title="下架" onClick="javascript:if(confirm('确定此通知下架？')){return true;}else{return false;}">下架</a>
				           <elseif condition="$item.is_open eq 2" />
						 <a href="{:U('Notice/opdown','id='.$item['id'].'&is_open='.$item['is_open'])}" title="上架" onClick="javascript:if(confirm('确定允许此通知上架？')){return true;}else{return false;}">上架</a>
					   <else/>
                                           </if>
					
	            </td>

                                        
                         <td>
                         <a href="{:U('Notice/editNotice','&id='.$item['id'])}">查看详情</a>
                       
					       <if condition="$item.check_status eq 1 ">
						 待审核
					        <elseif condition="$item.is_expired neq 100" />
						 已过期
						 <elseif condition="$item.is_open eq 1" />
						 <a href="{:U('Notice/opdown','id='.$item['id'].'&is_open='.$item['is_open'])}" title="下架" onClick="javascript:if(confirm('确定此通知下架？')){return true;}else{return false;}">下架</a>
						 <elseif   condition="$item.is_open eq 2" />
						 <a href="{:U('Notice/opdown','id='.$item['id'].'&is_open='.$item['is_open'])}" title="上架" onClick="javascript:if(confirm('确定允许此通知上架？')){return true;}else{return false;}">上架</a>
						 <else/>
                                                 </if>
	                 </td>
                    
                    
                    
                    
                    
                </tr>
              </foreach>
                </tbody>
            </table>
              {$page}
        </div>
    </div>
</div>



<script src="/App/Admin/public/js/jquery-2.1.1.min.js"></script>
<script src="/App/Admin/public/js/bootstrap.min.js"></script>
<script src="/App/Admin/public/js/jquery.datetimepicker.js"></script>
<script src="/App/Admin/public/js/jquery.bootgrid.min.js"></script>
<script src="/App/Admin/public/js/jquery.bootgrid.fa.min.js"></script>
<script src="/App/Admin/public/js/time.js"></script>



<script type="text/javascript">
$('.check').click(function(){
    var t=$(this);
    var text=$(this).html();
    var mymessage=confirm("你确定"+text+"此惠通知");  
    if(mymessage==true)  
    {  
        var state=$(this).attr("state");
        var cid=$(this).attr("cid");
       if(state==1){
        $(this).attr("state","0");
        state=0;
       }else{
        $(this).attr("state","1");
        state=1;
       }
          $.get('/benefitState',{'state':state,'cid':cid},function(data){
            if(data==1){
               if(text=="上架"){
                    t.html("下架");
                    t.parent().prev().html('上架');
               }else{
                    t.html("上架");
                    t.parent().prev().html('下架');

               }
            }
        })
    }  
    else if(mymessage==false)  
    {  
        
    }     
})
</script>
</body>
</html>